package lab03;
import java.util.Scanner;
public class Lab03 {
	
	public static void quadratic (double a,double b,double c)
	{
		double r1,r2,r;
		if(Math.pow(b*b-4*a*c,0.5)>0)
		{
		r1 = (-b+Math.pow(b*b-4*a*c,0.5))/(2*a);
		r2 = (-b-Math.pow(b*b-4*a*c,0.5))/(2*a);
		System.out.println(r1+ r2);
		}
		else if(Math.pow(b*b-4*a*c,0.5)==0)
		{
			r=-b/(2*a);
			System.out.println(r);
		}
		else
			System.out.println("The equation has no real roots");
		
	}
	public static void random()
	{
		int m=	(int)Math.random()*12+1;
		switch(m)
		{
		case 1: System.out.println("January");break;
		case 2: System.out.println("February");break;
		case 3: System.out.println("March");break;
		case 4: System.out.println("April");break;
		case 5: System.out.println("May");break;
		case 6: System.out.println("June");break;
		case 7: System.out.println("July");break;
		case 8: System.out.println("August");break;
		case 9: System.out.println("September");break;
		case 10: System.out.println("October");break;
		case 11: System.out.println("November");break;
		case 12: System.out.println("December");break;
		}
		
	}
	public static void cost(double w)
	{
		if(w>0&&w<=1)
			System.out.println(3.5);
		else if(w>1&&w<=3)
			System.out.println(5.5);
		else if(w>3&&w<=10)
			System.out.println(8.5);
		else if(w>10&&w<=20)
			System.out.println(10.5);
		else
			System.out.println("the package cannot be shipped.");
	}
	public static void ascill(int a)
	{
		char c=(char) a;
		System.out.println(c);
	}
	public static void major(String s)
	{
		String s1=null,s2=null;
		if(s.charAt(0)=='C')
			s1="Computer Science";
		else if(s.charAt(0)=='I')
			s1="Information Technology";
		else if(s.charAt(0)=='M')
			s1="Mathematics";
		if(s.charAt(1)=='1')
			s2="freshman";
		else if(s.charAt(1)=='2')
			s2="sophomore";
		else if(s.charAt(1)=='3')
			s2="junior";
		else if(s.charAt(1)=='4')
			s2="senior";
		System.out.println(s1 +" " +s2);
		
	}
	public static void stu()
	{
		int numberOfStudent;
        double highestScore = 0,tempScore;
        String studentName = "",tempName;

        Scanner inputScanner = new Scanner(System.in);
        System.out.print("Enter the number of the students:");
        numberOfStudent = inputScanner.nextInt();

        if(numberOfStudent > 0)
        {
            for(int i = 1;i <= numberOfStudent;i++)
            {
                System.out.print("Enter the student's name: ");
                tempName = inputScanner.next();
                System.out.print("Enter the student's score: ");
                tempScore = inputScanner.nextDouble();

                if(tempScore > highestScore)
                {
                    studentName = tempName;
                    highestScore = tempScore;
                }
            }
            System.out.println("The name of the student with the highest score is " + studentName);
        }
        else
            System.out.println("The number of the students is less than or equals to 0\n" + "Invalid input");

	}
	public static void factor()
	{
		  String factorsResult = "";

	        System.out.print("Enter an integer number: ");
	        Scanner inputScanner = new Scanner(System.in);
	        int number = inputScanner.nextInt();

	        for(int i = 2;number != 1;)
	        {
	            if(number % i == 0)
	            {
	                number /= i;
	                factorsResult += i + ", ";
	            }
	            else
	                i++;
	        }
	        factorsResult = factorsResult.substring(0,factorsResult.length()-2) + ".";
	        System.out.println("All its smallest factors are " + factorsResult);
	}
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
			double a,b,c;
			a=input.nextDouble();
			b=input.nextDouble();
			c=input.nextDouble();
			quadratic(a,b,c);
			random();
			double w=input.nextDouble();
			cost(w);
			int asc=input.nextInt();
			ascill(asc);
			String s=input.nextLine();
			major(s);
			stu();
			factor();
	}

}
